import request from "@/utils/request.js";

/**
 * 会员管理分页列表
 */
export function getMemberList(data) {
  return request({
    url: `/jy-member/mgmt/user/page`,
    method: "post",
    data,
  });
}
/**
 * 会员详情
 */
export function getMemberDetail(data) {
  return request({
    url: `/jy-member/mgmt/user/userInfoDetails`,
    method: "post",
    data,
  });
}
/**
 * 查询会员注册问题标签
 */
export function queryMemberSurveyLabel(params) {
  return request({
    url: `/jy-member/member/survey/queryMemberSurveyLabel`,
    method: "get",
    params,
  });
}
/**
 * 分页查询会员回访记录
 */
export function queryReturnVisitRecord(data) {
  return request({
    url: `/jy-member/member/return/visit/record/queryReturnVisitRecord`,
    method: "post",
    data,
  });
}
/**
 * 分页查询康复日志
 */
export function getTreatList(params) {
  return request({
      url: `/jy-business/treat`,
      method: "get",
      params,
  });
}
/**
 * 分页查询健康档案
 */
export function getHealthyList(params) {
  return request({
      url: `/jy-business/healthy`,
      method: "get",
      params,
  });
}
/**
 * 预约记录列表
 */
export function getReserveList(params) {
  return request({
      url: `/jy-business/reserve/list/manage`,
      method: "get",
      params,
  });
}
/**
 * 分页查询疗程记录
 */
export function getCourseList(data) {
  return request({
      url: `/jy-business/trans/order/verify/query/course`,
      method: "post",
      data,
  });
}
/**
 * 核销记录分页查询
 */
export function getVerifyList(data) {
  return request({
      url: `/jy-business/trans/order/verify/query/verify`,
      method: "post",
      data,
  });
}
/**
 * 分页查询项目记录
 */
export function getProjectList(data) {
  return request({
      url: `/jy-business/trans/order/verify/query/project`,
      method: "post",
      data,
  });
}
/**
 * 销售订单分页查询
 */
export function getSellList(data) {
  return request({
      url: `/jy-report/sell/data/query/page`,
      method: "post",
      data,
  });
}
/**
 * 获取用户负责人信息
 */
export function getPrincipalInfo(params) {
  return request({
      url: `/jy-member/mgmt/user/principal`,
      method: "get",
      params,
  });
}
/**
 * 会员导入-进度查询
 */
export function getImportProgress(batchId) {
  return request({
    url: `/jy-member/mgmt/user/import/${batchId}`,
    method: "get"
  });
}

/**
 * 管理平台-会员等级列表
 */
export function getMemberLevelList() {
  return request({
    url: `/jy-member/member/level/list`,
    method: "get",
  });
}

/**
 * 管理平台-添加会员等级
 * @param {object} data
*/
export function addMemberLevel(data) {
  return request({
    url: `/jy-member/member/level`,
    method: "post",
    data,
  });
}

/** 
 * 管理平台-修改会员等级
 * @param {string} levelId 等级id
 * @param {object} data
*/
export function updateMemberLevel(levelId, data) {
  return request({
    url: `/jy-member/member/level/${levelId}`,
    method: "post",
    data,
  });
}

/** 
 * 管理平台-删除会员等级
 * @param {string} levelId 等级id
*/
export function deleteMemberLevel(levelId) {
  return request({
    url: `/jy-member/member/level/${levelId}`,
    method: "delete",
  });
}

/** 
 * 管理平台-来源渠道分页列表
 * @param {object} data
*/
export function getChannelList(data) {
  return request({
    url: `/jy-member/source/channel/list`,
    method: "post",
    data,
  });
}

/**
 * 管理平台-新增-编辑来源渠道
 * @param {object} data
 * @param {string} id 来源渠道id
 * @param {string} sourceChannel 来源渠道名称
 * @param {string} remark 备注
 */
export function addChannel(data) {
  return request({
    url: `/jy-member/source/channel/operations`,
    method: "post",
    data,
  });
}

/**
 * 管理平台-删除来源渠道
 * @param {string} sourceChannelId 来源渠道id
*/
export function deleteChannel(sourceChannelId) {
  return request({
    url: `/jy-member/source/channel/deleteSourceChannel?sourceChannelId=${sourceChannelId}`,
    method: "delete",
  });
}

/** 
 * 管理平台-会员分层列表
 * @param {object} params
*/
export function getMemberLayeringNewList(data) {
  return request({
    url: `/jy-member/member/layering/page`,
    method: 'post',
    data
  })
}
export function getMemberLayeringList(params) {
  return request({
    url: `/jy-member/member/layering/list`,
    method: 'get',
    params
  })
}
/**
 * 管理平台-会员分层拖动排序
 * @param {array} layeringIdList id列表
 */
export function memberLayeringDragSort(layeringIdList) {
  return request({
    url: `/jy-member/member/layering/dragSort`,
    method: 'post',
    data: {
      layeringIdList
    }
  })
}
/**
 * 管理平台-会员分层新增-编辑
 * @param {object} data
 */
export function memberLayeringAction(data) {
  return request({
    url: `/jy-member/member/layering/ops`,
    method: 'post',
    data
  })
}
/**
 * 管理平台-删除会员分层
 * @param {string} layeringId
 */
export function deleteMemberLayering(layeringId) {
  return request({
    url: `/jy-member/member/layering/${layeringId}`,
    method: 'delete'
  })
}

/**
 * 管理平台-会员标签新增-编辑
 * @param {object} data
 */
export function saveMemberTag(data) {
  return request({
    url: `/jy-member/label/management/operations`,
    method: 'post',
    data
  })
}
/**
 * 管理平台-会员标签分页列表
 * @param {object} data
 */
export function getMemberTagPage(data) {
  return request({
    url: `/jy-member/label/management/pageList`,
    method: 'post',
    data
  })
}
/**
 * 管理平台-会员标签操作
 * @param {object} data
 */
export function setMemberTag(data) {
  return request({
    url: `/jy-member/member/label/memberLabelOpt`,
    method: 'post',
    data
  })
}
/**
 * 管理平台-删除会员标签
 * @param {string} labelId 标签id
 */
export function deleteMemberTag(labelId) {
  return request({
    url: `/jy-member/label/management/${labelId}`,
    method: 'delete'
  })
}
/** 
 * 管理平台-获取所有平台用户数量
*/
export function getMemberCount() {
  return request({
    url: `/jy-member/mgmt/user/count`,
    method: 'get'
  })
}